<script>

    $(function () {
        //导出逻辑
        $('.data-export .layui-btn').on('click', function(){
            let postData = postSearchData();
            postData['export'] = true;
            let url = "{$__url}?";
            let param = [];
            for (let key in postData){
                if (key=='button')
                    continue;
                param.push(key+"="+postData[key]);
            }
            let loading = layer.load(1, {
                shade: [0.1,'#fff']
            });
            window.location.href=url+param.join('&');
            layer.close(loading);
        });

    });

    function postSearchData() {
        let form = '{$__search.form}';
        form = form.split(',');
        let postData = {};
        $.each(form,function (k,v) {
            postData[v] = $("#"+v).val();
        });
        return postData;
    }

    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }

    function time2date(t){
        var t1 = parseInt(t + '000');
        return util.toDateString(t1);
    }

    function getNowFormatDate() {
        var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + '01 - '+year + seperator1 + month + seperator1 + strDate;
        return currentdate;
    }

    function getNowDate() {
        var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + strDate;
        return currentdate;
    }

</script>